<template>
	<view class="success-dialog-cover">
		<view class="success-dialog">
			<view class="dialog-content">
				<slot></slot>
			</view>
			<view class="dialog-footer">
				<view @click="handleCallback(false)" v-if="showCancel" class="iconfont icon-a-guanbiicon">
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'SuccessDialog',
		props: {
			showCancel: {
				type: Boolean,
				default: true
			}
		},
		emits: ['callback'],
		methods: {
			handleCallback(e) {
				this.$emit('callback', e)
			}
		}
	}
</script>

<style lang="scss">
	.success-dialog-cover {
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		background: rgba(0, 0, 0, 0.4);
		z-index: 9999;

		.success-dialog {
			position: absolute;
			transform: translate(-50%, -50%);
			left: 50%;
			top: 50%;
			width: calc(100% - 60rpx);
			height: auto;

			.dialog-content {
				background: #fff;
				width: 100%;
				padding: 30rpx;
				display: flex;
				flex-direction: column;
				border-radius: 10px;
			}

			.dialog-footer {
				width: 100%;
				height: 80rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin: 40rpx auto;

				.iconfont {
					color: #fff;
					font-size: 54rpx
				}
			}
		}
	}
</style>